import requests


class IhrmManage:
    def add_emp(self,req_header,req_body):
        return requests.post(url="http://ihrm2-test.itheima.net/api/sys/user",
                             headers=req_header,json=req_body)

    def modify_emp(self,emp_ip,req_header,req_body):
        return requests.put(url="http://ihrm2-test.itheima.net/api/sys/user/"+emp_ip,
                            headers=req_header,json=req_body)

    def query_emp(self,emp_ip,req_header):
        return requests.get(url="http://ihrm2-test.itheima.net/api/sys/user/"+emp_ip,
                            headers=req_header)

    def delete_emp(self,emp_ip,req_header):
        return requests.delete(url="http://ihrm2-test.itheima.net/api/sys/user/"+emp_ip,
                               headers=req_header)

if __name__ == '__main__':
    ihrm_emp = IhrmManage()
    req_header = {"Authorization":"57564941-0891-4eeb-9911-670640a500f7"}
    req_body = {
    "username":"刘凯is凯宝",
    "mobile":"18942190600",
    "workNumber":"11967"
}
    emp_id = "1650778328249937920"

    resp = ihrm_emp.query_emp(emp_id,req_header)
    print("查看员工:",resp.json())